<?php
class Webservices_Countries {
    private $_modelCountry;
    
    public function __construct(){
        $this->_modelCountry = new Application_Model_Country();
    }
    
    /**
     * Get country
     * @param string $username
     * @param string $password
     * @param string $countryId
     * @return string
     */
    public function getCountry($username, $password, $countryId){
        $res = array();
        $country = $this->_modelCountry->getCountry($countryId);
        if($country){
            $res = $country->toArray();
        }  
        $this->_modelCountry->convertItem($res);
        return json_encode($res);
    }
    
    /**
     * Get list contry
     * @author tien nguyen
     * @param string $username
     * @param string $password
     * @return string
     */
    public function getList($username, $password){
        $res = array();
        $contries = $this->_modelCountry->getList();
        if($contries){
            $res = $contries->toArray();
        }    
        $this->_modelCountry->convertArray($res);
        return json_encode($res);
    }
}